using I2.Loc;
using UnityEngine;

public class GameplayEventMessage : RewardMessage
{
	public UISprite iconSprite;

	public UILabel nameLabel;

	public UILabel pointsLabel;

	public void SetMessageInfo(GameplayEvent gameplayEvent)
	{
		string empty = string.Empty;
		Color color;
		switch (gameplayEvent.rewardMessagesSettings)
		{
		case RewardMessages.Headshoot:
			empty = "Kill";
			color = new Color(1f, 0.149f, 0.149f, 1f);
			break;
		case RewardMessages.MultiKill:
			empty = "Multikill";
			color = new Color(0.909f, 0.007f, 0.301f, 1f);
			break;
		case RewardMessages.Mincer:
			empty = "Mincer";
			color = new Color(1f, 0.392f, 0.968f, 1f);
			break;
		case RewardMessages.CarKill:
			empty = "Split";
			color = new Color(0.858f, 0.274f, 0f, 1f);
			break;
		case RewardMessages.BoomKill:
			empty = "Boomkill";
			color = new Color(1f, 0.454f, 0f, 1f);
			break;
		case RewardMessages.VehicleGunKill:
			empty = "VehicleGunKill";
			color = new Color(1f, 0.454f, 0f, 1f);
			break;
		case RewardMessages.DuckHunt:
			empty = "Duckhunt";
			color = new Color(0.384f, 0f, 0.572f, 1f);
			break;
		case RewardMessages.JetShoot:
			empty = "Jetshoot";
			color = new Color(1f, 0.941f, 0f, 1f);
			break;
		case RewardMessages.GhostKill:
			empty = "Gostkill";
			color = new Color(1f, 0f, 0.462f, 1f);
			break;
		case RewardMessages.Revenge:
			empty = "Revange";
			color = new Color(0.909f, 0.007f, 0.301f, 1f);
			break;
		case RewardMessages.SpawnKill:
			empty = "Spaunkill";
			color = new Color(0.384f, 0f, 0.572f, 1f);
			break;
		case RewardMessages.Destruction:
			empty = "Destruktion";
			color = new Color(1f, 0.454f, 0f, 1f);
			break;
		case RewardMessages.Driving:
			empty = "Hightfly";
			color = new Color(0f, 0.396f, 1f, 1f);
			break;
		case RewardMessages.KillZombies:
			empty = "Kill_30_zomby";
			color = new Color(1f, 0.454f, 0f, 1f);
			break;
		case RewardMessages.KillPolice:
			empty = "Kill_30_kop";
			color = new Color(0f, 0.396f, 1f, 1f);
			break;
		case RewardMessages.KillAgressive:
			empty = "Kill_30_gungsta";
			color = new Color(1f, 0.454f, 0f, 1f);
			break;
		case RewardMessages.KillCitizens:
			empty = "Kill_30_mob";
			color = new Color(1f, 0.149f, 0.149f, 1f);
			break;
		case RewardMessages.StealCars:
			empty = "Stealing_30";
			color = new Color(0f, 0.396f, 1f, 1f);
			break;
		case RewardMessages.EscapeFromPolice:
			empty = "Wanted_30_Bullets";
			color = new Color(0.909f, 0.007f, 0.301f, 1f);
			break;
		case RewardMessages.RocketLeagueGoal_1:
			empty = "RocketLeagueGoal_1";
			color = new Color(1f, 0.454f, 0f, 1f);
			break;
		case RewardMessages.RocketLeagueGoal_2:
			empty = "RocketLeagueGoal_2";
			color = new Color(1f, 0.454f, 0f, 1f);
			break;
		case RewardMessages.RocketLeagueGoal_3:
			empty = "RocketLeagueGoal_2";
			color = new Color(1f, 0.454f, 0f, 1f);
			break;
		case RewardMessages.RocketLeagueGoal_4:
			empty = "RocketLeagueGoal_2";
			color = new Color(1f, 0.454f, 0f, 1f);
			break;
		case RewardMessages.RocketLeagueGoal_5:
			empty = "RocketLeagueGoal_2";
			color = new Color(1f, 0.454f, 0f, 1f);
			break;
		case RewardMessages.RocketLeagueGoal_6:
			empty = "RocketLeagueGoal_2";
			color = new Color(1f, 0.454f, 0f, 1f);
			break;
		case RewardMessages.RocketLeagueGoal_Save:
			empty = "RocketLeagueGoal_Save";
			color = new Color(1f, 0.454f, 0f, 1f);
			break;
		default:
			empty = string.Empty;
			color = Color.white;
			break;
		}
		if (!string.IsNullOrEmpty(empty))
		{
			iconSprite.spriteName = empty;
		}
		string gameEventLocalizationText = ScriptLocalization.GetGameEventLocalizationText(gameplayEvent.name);
		if (!string.IsNullOrEmpty(gameEventLocalizationText))
		{
			nameLabel.text = gameEventLocalizationText;
		}
		else
		{
			nameLabel.text = gameplayEvent.name;
		}
		nameLabel.color = color;
		string text = string.Empty;
		int eventXP = GetEventXP(gameplayEvent);
		if (eventXP >= 0)
		{
			text = "+";
		}
		if (GameplayRewardManager.instance.CanGiveReward())
		{
			pointsLabel.text = text + eventXP;
			if (eventXP == 0)
			{
				pointsLabel.text = string.Empty;
			}
		}
		else
		{
			pointsLabel.text = string.Empty;
		}
		Invoke("RemoveWithAnimation", liveTime);
	}

	private int GetEventXP(GameplayEvent gameplayEvent)
	{
		if (settings.offlineMode)
		{
			return gameplayEvent.offlineXP;
		}
		return gameplayEvent.pvpXP;
	}

	private float GetEventREP(GameplayEvent gameplayEvent)
	{
		if (settings.offlineMode)
		{
			return gameplayEvent.offlineREP;
		}
		return gameplayEvent.pvpREP;
	}
}
